package com.le.tester.book.effectivejava3rdchinese.articlesix;

import java.time.LocalDateTime;

/**
 * createTime：2022/7/30 16:39
 * description：装箱和拆箱的性能比较(装箱是8s，拆箱是1s)
 */
public class BoxEffective {

    private static long sum() {

        long sum = 0L;
        for (int i = 0; i < Integer.MAX_VALUE; i++) {
            sum = sum + i;
        }
        return sum;
    }

    public static void main(String[] args) {

        LocalDateTime startTime = LocalDateTime.now();
        long sum = BoxEffective.sum();
        System.out.println(sum);

        LocalDateTime endTime = LocalDateTime.now();

        System.out.println("dur time is " + (endTime.getSecond() - startTime.getSecond()));

    }
}
